home *** CD-ROM | disk | FTP | other *** search
Wrap
/* graphics libraries: Better gxShape framing routines by Cary Clark, Georgiann Delaney, Michael Fairman, Pablo Fernicola, Dave Good, Robert Johnson, Keith McGreggor, Oliver Steele, David Van Brink, Chris Yerga Copyright 1987 - 1993 Apple Computer, Inc. All rights reserved. */ #include "graphics libraries.h" void OutsetShape(gxShape source, Fixed outset) { gxShape temp = GXCopyToShape(nil, source); boolean framed = GXGetShapeFill(source) < gxEvenOddFill; GXSetShapeFill(source, gxWindingFill); GXSetShapeFill(temp, gxClosedFrameFill); GXSetShapeStyleAttributes(temp, gxCenterFrameStyle); GXSetShapePen(temp, (outset < 0 ? -outset : outset) << 1); GXPrimitiveShape(temp); if (outset > 0) /* if we are outsetting */ GXUnionShape(source, temp); else if (outset < 0) /* if we are insetting */ GXDifferenceShape(source, temp); if (framed) GXSetShapeFill(source, gxClosedFrameFill); GXDisposeShape(temp); } void FrameShape(gxShape source, Fixed outset) { gxShape temp = GXCopyToShape(nil, source); gxShapeFill originalFill = GXGetShapeFill(source); GXSetShapeFill(temp, gxWindingFill); GXSetShapeFill(source, gxClosedFrameFill); GXSetShapeStyleAttributes(source, gxCenterFrameStyle); GXSetShapePen(source, (outset < 0 ? -outset : outset) << 1); GXPrimitiveShape(source); if (outset > 0) /* if we are outside framing */ GXDifferenceShape(source, temp); else if (outset < 0) /* if we are inside framing */ GXIntersectShape(source, temp); else /* the outset is 0 */ GXSetShapeFill(source, gxClosedFrameFill); GXDisposeShape(temp); }